package development;

import state.GameConstants;
import state.GameForm;
import state.GameGlobal;
import state.Graphics;
import state.font.FontManager;
import state.font.ImageText;
import state.util.Hashtable;

public class FrmChatRoom extends GameForm {
  private ImageText text8;
  
  private static GameForm singleton;
  
  public static GameForm instance() {
    if (singleton == null) {
      singleton = new FrmChatRoom();
    }
    return singleton;
  }

  public void init(Hashtable parameters) {
    _manager.setBackGroundColor(0x440000);
    text8 = FontManager.getFont(FontManager.FONT_SIZE_8);
    _manager.enableTouchPad();
  }
  
  public void draw(Graphics g) {
    DrawUtils.drawBackground(g);
    DrawUtils.drawTopBar(g);
    
    if (Global.currentChatRoom != null) {
      text8.drawString1(g, "Phòng chat " + Global.currentChatRoom.getTitle(), GameConstants.SCREEN_WIDTH / 2, 2, GameConstants.TOP_HCENTER_ANCHOR);
    }
    
  }

  public void keyReleased(int keyCode) {
    GameGlobal.nextState(FrmListRoom.instance(), null);
  }
  
  public void destroy() {
    text8 = null;
  }
}
